-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Use "$container" consistently #18299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
DOCtor-RST would need to be configured the other way around, asking ppl to rename to |
You can change it in -- { type: 'ContainerConfigurator', name: 'containerConfigurator' }
+- { type: 'ContainerConfigurator', name: 'container' } |
Thanks! PR updated. |
I'm still divided about this. I'm all in for as short as possible variable names. But, at the same time, variable names should be precise and self-explanatory. "Container", "container builder" and "container configurator" are not the same (and they are implemented in three totally different classes). If we have Let's ask others @symfony/team-symfony-docs Thanks! |
We're using |
…er builder+configurator (nicolas-grekas) This PR was merged into the 6.3 branch. Discussion ---------- Consistently use var $container to reference the container builder+configurator | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Related to symfony/symfony-docs#18299 The vast majority of the code base uses `$container` to reference either the `ContainerBuilder` or the `ContainerConfigurator`, depending on the context. There are just a few inconsistencies, fixed in this PR. Commits ------- 3f2c196 Consistently use var $container to reference the container builder+configurator
Like I also said in the original issue: to me, this is a non-issue and we should just choose one and use it. As long as it's not an abbreviation ( I think Nicolas makes a good point that we're now inconsistent with the code, which makes it (a) harder to read the code after learning the docs and (b) trigger errors from static analysers which have become very strict with names after the introduction of named parameters. So I think it's indeed good to move to the same naming standard as Symfony code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also ok for me - type-hints are there as well, of course, to help.
Thank you Nicolas. |
Takes the other road from #17683 as discussed in #18295
Using
$containerBuilder
and$containerConfigurator
is unnecessarily long, consuming horizontal space without adding any clarity.This also aligns the name
$container
with existing practice in the code and in recipes.